package com.trend.web;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RestController;

import com.trend.pojo.IndexData;
import com.trend.service.IndexDataService;

@RestController
public class IndexDataController {

	@Autowired
	IndexDataService indexDataService;

	// 刷新indexData
	@GetMapping("/freshIndexData/{code}")
	public String fresh(@PathVariable("code") String code) throws Exception {
		indexDataService.fresh(code);
		return "fresh indexData success";
	}

	// 获取indexData
	@GetMapping("/getIndexData/{code}")
	public List<IndexData> get(@PathVariable("code") String code) throws Exception {
		return indexDataService.get(code);
	}

	// 删除indexData
	@GetMapping("/removeIndexData/{code}")
	public String remove(@PathVariable("code") String code) throws Exception {
		indexDataService.remove(code);
		return "remove indexData success";
	}

}
